// To parse this JSON data, do
//
//     final welcome = welcomeFromJson(jsonString);

import 'dart:convert';

class AccountModel {
  AccountModel({
    this.id,
    required this.wid, //钱包ID
    required this.name, //帐号名称 ，跟钱包名称不是同一个/
    required this.nid, // 网络 id
    required this.mainnid, // 网络 id
    // required this.mode, // 帐号模式 1创建2导入
    required this.i, // 帐号的index
    required this.addr, // 帐号地址
    required this.addrType,
    required this.symbol,
  });

  int? id;
  int wid;
  String name;
  int nid;
  int mainnid;
  String addr;
  int i;
  int addrType;
  String symbol;

  factory AccountModel.fromRawJson(String str) => AccountModel.fromJson(json.decode(str));

  String toRawJson() => json.encode(toJson());

  static AccountModel init() {
    return AccountModel(id: 0, wid: 0, name: '', nid: 0, mainnid: 0, i: 0, addr: '', symbol: '', addrType: 0);
  }

  factory AccountModel.fromJson(Map<String, dynamic> json) => AccountModel(
        id: json["id"],
        wid: json["wid"],
        name: json["name"],
        nid: json["nid"],
        mainnid: json["mainnid"],
        addr: json["addr"],
        addrType: json["addrType"],
        i: json["i"],
        symbol: json["symbol"],
      );

  Map<String, dynamic> toJson() => {
        "id": id,
        "wid": wid,
        "name": name,
        "nid": nid,
        "mainnid": mainnid,
        "addr": addr,
        "addrType": addrType,
        "i": i,
        "symbol": symbol,
      };
}
